Repository navigation
perf(video): shorten the docked 1080p picture lane - #13
Merged
Merged
Conversation
nvtegra rescales NVDEC every 20 pictures so that one takes about a frame interval, with a 180 MHz floor up to 1080p. That is playback's rule. In a stream it left a 1080p picture 7.6 ms of decode, and with the VIC transfer and the copy the lane filled the 60 Hz frame: docked play fell behind. Above 720p the shim asks the decoder's own clock request for the top rate again after each rescale, and closing the decoder releases it. Handheld keeps the scaling: 720p fits there, and the clock costs battery. The nvdec line carries NVDEC's clock, so a console run shows what each window decoded at.
Every stream frame cleared the full-screen UI image, flushed Skia and blended the layer over the picture, though with stats off and the dial closed it held nothing. At 1080p that is three full-screen passes on the memory bus that NVDEC, the VIC and the copy share. The stream now tells the display when its overlay is empty, and the presenter skips the draw, the flush and the blend. Leaving the stream turns the layer back on.
The handheld clock needs the maintainer's yes; sampling the decoded surface in place needs a console probe first.
pkg-config's link flags came out before the shim's own archive. With --as-needed, as on Debian's toolchain, the linker dropped libavcodec before anything used it, so the crate's own tests did not link alone. Naming the libraries after the shim keeps them.
The stream's size was the wrong gate: a handheld 1080p stream took the top clock and its battery cost. Docked, the console is on mains and the 1080p picture needs the headroom. Handheld keeps nvtegra's own scaling, which already decodes 720p in about 4 ms. The lane asks at each access unit, so a dock change mid-stream moves the clock without a new decoder. Turning it off hands NVDEC back to nvtegra's scaling at its next rescale.
At docked 1080p each picture paid a VIC transfer (seven nvdrv calls and a 3 MB cache flush), then a 3 MB copy into uncached staging, then a staging copy on the GPU. That serial lane was most of why 1080p60 did not fit a frame. The presenter now imports each decoder surface once as host memory and detiles its block-linear planes as it samples them. A layout or import the console does not honour would show a wrong picture, so each decoder starts on the VIC. Its first detailed picture is read back through the GPU at the addresses the shader samples and compared with the VIC's copy; only a match moves the lane in place, and any later failure moves it back for good. A vic-copia file keeps the VIC for an A/B. Imports carry the decoder's pool generation: a replaced pool may free addresses a new one reuses.
Member
Author
|
Merging over the red CI could not hand out the NRO anyway: the account's artifact storage quota is full. To test: pull |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Docked 1080p60 did not fit a frame: each picture ran NVDEC, a VIC transfer, a 3 MB CPU copy into uncached staging and a staging copy on the GPU, one after another, with NVDEC under-clocked by nvtegra's scaling and the UI layer composited every frame.
What changes
a2f4b47).b3380d1, then08e8a01). nvtegra's scaling puts a 1080p picture at about 8 ms. Handheld keeps that scaling by default; the dock state is asked at each access unit, so a dock change mid-stream moves the clock.nvdec[10s]now shows the clock.c65be0a). Each NVDEC surface is imported once (VK_EXT_external_memory_host) and the new tiled CSC pass detiles its 16Bx2 block-linear planes as it samples. No VIC transfer, no copy, no upload.vic-copiain/switch/punktfunk/keeps the VIC route for an A/B.vic-direto(straight VIC) also keeps it.pf-nx-syslinks libavcodec after the shim (5db41e6): its tests did not link on their own on Debian.Checked
-D warnings,cargo test --workspace. New lavapipe tests inpf-nx-vk/tests/in_place.rsdraw a block-linear surface through the tiled pass against the same picture through the NV12 upload: within 3 LSB at 1:1 and 8 scaled (the upload's 8-bit sampler against the pass's float filter); a pitch-linear surface misses by more than 32; the read-back check tells the two layouts apart.cargo-nx.sh check -p pf-nx -p pf-nx-probeand the NRO build.Not proven: the console run
in place: picture … read back as the VIC wrote it; pictures now go in place, thennvdec[10s]withroute in place, and the picture right.read back otherwiseorback to the VIC, that line is the finding; the stream keeps running on the VIC.nvdec[10s]shows nvtegra's own clock, not the top one.vic-copiaon the SD card, same stream.